package main

import (
	"context"
	"fmt"
	"github.com/reactivex/rxgo/v2"
)

func main() {

	create := rxgo.Create([]rxgo.Producer{func(ctx context.Context, next chan<- rxgo.Item) {
		next <- rxgo.Of("Hello")
		next <- rxgo.Of("World")
		next <- rxgo.Of("!")
	}})
	observable := create.Map(func(ctx context.Context, i interface{}) (interface{}, error) {
		return fmt.Sprintf("%s %s", i, "!"), nil
	})
	observe := observable.Observe()
	for item := range observe {
		fmt.Println(item.V)
	}
}
